package cn.amaake.service;

import com.jfinal.plugin.activerecord.Page;

import cn.amaake.common.model.Menu;
import cn.amaake.common.model.User;

import java.util.List;

public class UserServiceImp implements UserService {

    @Override
    public User login(String username, String password) {
        return User.dao.login(username,password);
    }

    @Override
    public List<Menu> getMenu(int roleid) {
        return User.dao.getMenu(roleid);
    }

    @Override
    public Page<User> getUserPage(int pageNumber,int pageSize,String username) {
        return User.dao.getUserPage(pageNumber,pageSize,username);
    }

    @Override
    public boolean addUser(User user) {
        return user.save();
    }

    @Override
    public boolean updateUser(User user) {
        return user.update();
    }

    @Override
    public boolean deleteUser(int userid) {
        return User.dao.deleteById(userid);
    }
}
